Vue.component('my-el-pagination', {
    props: {
        total: {
            type: Number
        }, // 总条数
        page_index: {
            type: Number
        },
    },
    data: function () {
        return {
            pageSizes: [10, 20, 50, 100],
            page: {
                pageNum: 1,
                pageSize: DEFAULT_PAGE_SIZE
            }
        };
    },
    template: ' <el-pagination small  class="text-center"  @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page_index" :page-sizes="pageSizes" :page-size="page.pageSize"\n' +
    '    layout="total, sizes, prev, pager, next, jumper" :total="total">\n' +
    '    </el-pagination>',
    methods: {
        // // 每页查看条数变化
        handleSizeChange(val) {
            this.page.pageSize= val;
            this.$emit('pagination_change', this.page);
        },
        // 当前页码变化
        handleCurrentChange(val) {
            this.page.pageNum= val;
            this.$emit('pagination_change', this.page);
        }
    }

});